package com.tnr.scgcxx.controller.info;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.tnr.scgcxx.model.Customer;
import com.tnr.scgcxx.service.info.CustomerService;

@Controller @RequestMapping("/info")
public class CusView {
	
	
	@Resource
	private CustomerService customerService;
	
	@RequestMapping(value="/customer_to",method=RequestMethod.GET)
	public String customerTo() {
		return "info/customer";
	}
	
	@GetMapping("/customer_add_to")
	public String customerAddTo() {
		return "info/customer_add";
	}
	
	@GetMapping("/customer_upd_to")
	public String customerUpdTo(String cus_id,Model model) {
		Customer cus=customerService.getCustomer(cus_id);
		model.addAttribute("cus", cus);
		return "info/customer_upd";
	}
	
}
